package com.cy.pj.goods.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cy.pj.goods.dao.GoodsDao;
import com.cy.pj.goods.pojo.Goods;
import com.cy.pj.goods.service.GoodsService;

@Service
public class GoodsServiceImpl implements GoodsService{
	
	@Autowired
	private GoodsDao goodsDao;
	
	/**重写查询方法*/
	@Override
	public List<Goods> findAll() {
		
		return goodsDao.findAll();
	}
	
	/**根据id删除数据 */
	@Override
	public int deleteById(Integer id) {
		
		int rows = goodsDao.deleteById(id);
		return rows;
	}
	
	/**添加数据*/
	@Override
	public int saveGoods(Goods goods) {
		//.......
		goods.setCreatedTime(new java.util.Date());
		return goodsDao.saveGoods(goods);
	}
	
	/**根据ID修改数据*/
	@Override
	public Goods findById(Integer id) {
		//.....
		return goodsDao.findById(id);
	}
	@Override
	public int updateGoods(Goods goods) {
		
		return goodsDao.updateGoods(goods);
	}

	
}
